/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-04-21 09:37:22
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-07-28 14:07:43
 * @FilePath: \cxl-h5\src\pages\personalCenter\wallet\refund\history\index.ts
 */
import { refundRecordList } from '@/apis/refund'
import { BasicData } from '@/utils/basicData'
import { reactive, ref } from 'vue'

export default class RefundList extends BasicData {
    //下拉刷新
    refreshLoading = ref(false)
    //内容数据刷新
    dataLoading = ref(false)
    //内容结束刷新
    dataFinished = ref(false)
    //分页
    pagination: any = reactive({
        pageNo: 1,
        pageSize: 10
    })
    list: any[] = reactive([])
    empty = ref(false)
    constructor() {
        super()
        refundRecordList().then(res => {
            if (res.data.value === 200) {
                this.list.push(...res.data.data)
                this.empty.value = this.list.length ? false : true
            }
        })
    }
    //拉取数据
    getData = () => {}
    //刷新方法
    onRefresh = () => {
        console.log('下拉刷新')
        this.refreshLoading.value = true
        this.dataFinished.value = false
        this.dataLoading.value = true
        this.pagination.pageNo = 1
        this.list.length = 0
        this.getData()
    }
    //加载数据
    onLoad = () => {
        console.log('加载数据')
        this.getData()
    }
    //打开详情
    openRefundDetailed = (index: number) => {
        this.router.push({
            path: '/refund/' + this.list[index].id,
            query: { type: this.list[index].refundStatus, id: this.list[index].id }
        })
    }
    onOpenDetection = () => {
        this.router.go(-2)
    }
}
